package ar.edu.unq.wannaplay.builders;

import java.util.ArrayList;
import java.util.List;

import ar.edu.unq.wannaplay.employee.Employee;
import ar.edu.unq.wannaplay.employee.PersonalData;
import ar.edu.unq.wannaplay.employee.Register;
import ar.edu.unq.wannaplay.employee.Skill;
import ar.edu.unq.wannaplay.employee.SocialPlan;
import ar.edu.unq.wannaplay.entity.Entity;
import ar.edu.unq.wannaplay.ocupation.Ocupation;

public class EmployeeBuilder implements Builder {
    private Register register;

    private PersonalData data;

    private SocialPlan socialPlan;

    private String art;

    private Ocupation ocupation;

    private List<Skill> skills = new ArrayList<Skill>();

    @Override
    public Employee build() {
        PersonalData persData = this.getData();
        if (this.getData() == null) {
            persData = new PersonalData();
            persData.setId("12345678");
        }
        return new Employee(this.getRegister(), persData, this.getSocialPlan(), this.getArt(), this.getOcupation(),
                this.getSkills());
    }

    public EmployeeBuilder withRegister(final Register aRegister) {
        this.setRegister(aRegister);
        return this;
    }

    public EmployeeBuilder withPersonalData(final PersonalData aPersonalData) {
        this.setData(aPersonalData);
        return this;
    }

    public EmployeeBuilder withOcupation(final Ocupation anOcupation) {
        this.setOcupation(anOcupation);
        return this;
    }

    public EmployeeBuilder withSkills(final List<Skill> listSkills) {
        this.setSkills(listSkills);
        return this;
    }

    // setters&getters
    public void setRegister(final Register register) {
        this.register = register;
    }

    public Register getRegister() {
        return register;
    }

    public void setData(final PersonalData data) {
        this.data = data;
    }

    public PersonalData getData() {
        return data;
    }

    public void setOcupation(final Ocupation ocupation) {
        this.ocupation = ocupation;
    }

    public Ocupation getOcupation() {
        return ocupation;
    }

    public void setSkills(final List<Skill> skills) {
        this.skills = skills;
    }

    public List<Skill> getSkills() {
        return skills;
    }

    public void setSocialPlan(final SocialPlan socialPlan) {
        this.socialPlan = socialPlan;
    }

    public SocialPlan getSocialPlan() {
        return socialPlan;
    }

    public void setArt(final String art) {
        this.art = art;
    }

    public String getArt() {
        return art;
    }

    @Override
    public void modifyDefaultAttribute(final Entity entity) {
        ((Employee) entity).setArt("wasd");
    }

}
